package com.cash.app.ui.loan

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.cash.app.base.BaseViewModel
import com.cash.app.net.NetRequestExecutor
import com.cash.app.net.RetrofitClient
import com.cash.app.ui.loan.api.LoanAPIService
import com.cash.app.ui.loan.model.ScoreRequest

class LoanConfirmResultViewModel : BaseViewModel() {
    
    private val loanAPIService by lazy {
        RetrofitClient.createService(LoanAPIService::class.java)
    }

    private val _canScoreData = MutableLiveData<Boolean>()
    val canScoreData: LiveData<Boolean> = _canScoreData

    fun getCanScore() {
        launchRequest(request = {
            NetRequestExecutor.baseNetRequest {
                loanAPIService.getCanScore()
            }
        }, onSuccess = { response ->
            response?.let {
                _canScoreData.value = it.can_scoring
            }
        })
    }

    fun submitScore(score: Int, like: Int) {
        launchRequest(request = {
            NetRequestExecutor.baseNetRequest {
                loanAPIService.submitScore(ScoreRequest(score, like))
            }
        }, onSuccess = { response ->
            response?.let {}
        })
    }
} 